[PHP] How to unset object's inherited properties ?

Posted by vbklv on Stack Overflow See other posts from Stack Overflow or by vbklv
Published on 2010-04-08T14:14:17Z Indexed on 2010/04/08 14:23 UTC
Read the original article Hit count: 138

Filed under:
|
|
|
|

I have an Object

    (
        [id] => 1
        [parent_id] => 0
        [result:Database:private] => 
        [db:Database:private] => mysqli Object
            (
                [affected_rows] => 0
                ...
            )

    )

Obviously, the Object has inherited the 'db' and 'result' properties of the parent Database class.

unset($object->result) nor unset($object->result:Database) nor unset($object->result:Database:private) work.

How could I unset those properties when they are no longer needed (i.e. when the object properties are about to be output)?

Is it a generally a good idea to have a database object as an inherited property of other classes (extend one Database class with all other classes that use database connections)?

© Stack Overflow or respective owner

Related posts about php

Related posts about parent